#ifndef CONSOLE_LISTENER_HPP
#define CONSOLE_LISTENER_HPP

#include <string>
#include <thread>
#include <mutex>
#include <queue>
#include <atomic>
#include <optional>

class ConsoleListener {
public:
    ConsoleListener();
    ~ConsoleListener();

    void start();
    void stop();

    std::optional<std::string> getCommand();

private:
    void listenerLoop();

    std::thread listener_thread_;
    std::atomic<bool> is_running_;

    std::mutex queue_mutex_;
    std::queue<std::string> command_queue_;
};

#endif // CONSOLE_LISTENER_HPP